/*
 * Copyright (C) 2013 Daniel Wasilew <daniel.wasilew@codeminer.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.codeminer.parts.application;

import java.io.File;

/**
 *
 * @author Daniel Wasilew <daniel.wasilew@codeminer.org>
 */
public class ApplicationContext {

    private File libraryFolder;
    private File artworkFolder;
    private File configurationDir;
    private File databaseDir;
    private File logDir;
    private File baseDir;
    private File tmpDir;
    private File helpDir;
    private boolean development;
    private Application application;
    private File databaseScriptDir;

    public ApplicationContext() {
    }

    public void setLibraryFolder(File libraryDir) {
        this.libraryFolder = libraryDir;
    }

    public void setConfigurationDir(File configurationDir) {
        this.configurationDir = configurationDir;
    }

    public void setBaseDir(File baseDir) {
        this.baseDir = baseDir;
    }

    public void setDatabaseDir(File databaseDir) {
        this.databaseDir = databaseDir;
    }

    public File getConfigurationDir() {
        return configurationDir;
    }

    public File getDatabaseDir() {
        return databaseDir;
    }

    public File getLibraryFolder() {
        return libraryFolder;
    }

    public File getArtworkFolder() {
        return artworkFolder;
    }

    public File getLogDir() {
        return logDir;
    }

    public void setLogDir(File logDir) {
        this.logDir = logDir;
    }

    public void setArtworkFolder(File artworkFolder) {
        this.artworkFolder = artworkFolder;
    }

    public void setTmpDir(File tmpDir) {
        this.tmpDir = tmpDir;
    }

    public File getTmpDir() {
        return tmpDir;
    }

    public File getBaseDir() {
        return baseDir;
    }

    public boolean isDevelopment() {
        return development;
    }

    public void setDevelopment(boolean development) {
        this.development = development;
    }

    public void setApplication(Application application) {
        this.application = application;
    }

    public <T> T getApplicationPart(Class<T> classDescriptor) {
        if (application == null) {
            throw new IllegalStateException("please iniated Application first");
        }
        return this.application.getApplicationPart(classDescriptor);
    }

    public void setHelpDir(File helpDir) {
        this.helpDir = helpDir;
    }

    public File getHelpDir() {
        return helpDir;
    }

    public void setDatabaseScriptDir(File databaseScriptDir) {
        this.databaseScriptDir = databaseScriptDir;
    }

    public File getDatabaseScriptDir() {
        return databaseScriptDir;
    }
}
